<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm">
<div id="col100">
    <fieldset class="adminform">
        <legend><?php echo JText::_('COM_JOOMDIET_EDIT_LEGEND'); ?></legend>
        <table class="adminform">
            <tr>
                <input type="hidden" name="variable_id" id="variable_id" value="<?php echo $this->row->id; ?>" />
                <td width="100" align="right"><label for="variable_name"><?php echo JText::_('COM_JOOMDIET_VARIABLES_NAME'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="140" name="variable_name" id="variable_name" value="<?php echo $this->row->name; ?>" /></td>
            </tr>
            <tr>
                <td align="right"><label for="variable_units"><?php echo JText::_('COM_JOOMDIET_VARIABLES_UNITS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="variable_units" id="variable_units" value="<?php echo $this->row->unit; ?>" /></td>
            </tr>
            <tr>
                <td align="right"><label for="variable_min_value"><?php echo JText::_('COM_JOOMDIET_MIN_VALUE'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="140" name="variable_min_value" id="variable_min_value" value="<?php echo $this->row->min_value; ?>" /></td>
            </tr>
            <tr>
                <td align="right"><label for="variable_max_value"><?php echo JText::_('COM_JOOMDIET_MAX_VALUE'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="140" name="variable_max_value" id="variable_max_value" value="<?php echo $this->row->max_value; ?>" /></td>
            </tr>
            <tr>
                <td align="right"><label for="variable_category"><?php echo JText::_('COM_JOOMDIET_CATEGORY'); ?></label></td>
                <td>
                    <select name="variable_category" id="variable_category" value="<?php echo $this->row->category; ?>">
                        <option value="0" <?php echo $this->row->category==0?'selected="selected"':''; ?>><?php echo JText::_('COM_JOOMDIET_GENERAL'); ?></option>
                        <option value="1" <?php echo $this->row->category==1?'selected="selected"':''; ?>><?php echo JText::_('COM_JOOMDIET_MINERALS'); ?></option>
                        <option value="2" <?php echo $this->row->category==2?'selected="selected"':''; ?>><?php echo JText::_('COM_JOOMDIET_VITAMINS'); ?></option>
                    </select>
                </td>
            </tr>
            <tr>
                <td align="right"><label for="variable_description"><?php echo JText::_('COM_JOOMDIET_VARIABLES_DESCRIPTION'); ?></label></td>
                <td><?php // loading joomla editor
                    $editor =& JFactory::getEditor();
                    $params = array('smilies' => '0',
                                        'style' => '1',
                                        'layer' => '0',
                                        'table' => '0',
                                        'clear_entities' => '0');
                        echo $editor->display('variable_description', $this->row->description, '600', '400', '40', '20', false, $params);
                ?></td>
            </tr>
        </table>
    </fieldset>
    <fieldset class="adminform">
        <legend><?php echo JText::_('COM_JOOMDIET_RECOMENDED_INGESTS'); ?></legend>
        <table class="adminForm">
            <tr>
                <td width="100" align="left" colspan="8"><b><?php echo JText::_('COM_JOOMDIET_INFANT'); ?></b></td>
            </tr>
                <!-- row browsing -->
            <tr>
                <td width="100" align="right"><label for="infant0_1">0 - 1 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="infant0_1" id="infant0_1" <?php
                    if (is_array($this->infant) and (count($this->infant) == 1)) {
                        echo 'value="'.$this->infant['0']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
            </tr>
            <tr>
                <td width="100" align="left" colspan="8"><b><?php echo JText::_('COM_JOOMDIET_CHILDREN'); ?></b></td>
            </tr>
                <!-- row browsing -->
            <tr>
                <td width="100" align="right"><label for="children1_3">1 - 3 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="children1_3" id="children1_3" <?php
                    if (is_array($this->children) and (count($this->children) == 2)) {
                        echo 'value="'.$this->children['0']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="children4_8">4 - 8 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="children4_8" id="children4_8" <?php
                    if (is_array($this->children) and (count($this->children) == 2)) {
                        echo 'value="'.$this->children['1']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
            </tr>
            <tr>
                <td width="100" align="left" colspan="8"><b><?php echo JText::_('COM_JOOMDIET_MEN'); ?></b></td>
            </tr>
                <!-- row browsing -->
            <tr>
                <td width="100" align="right"><label for="men9_13">9 - 13 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="men9_13" id="men9_13" <?php
                    if (is_array($this->men) and (count($this->men) == 4)) {
                        echo 'value="'.$this->men['0']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="men14_18">14 - 18 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="men14_18" id="men14_18" <?php
                    if (is_array($this->men) and (count($this->men) == 4)) {
                        echo 'value="'.$this->men['1']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="men19_70">19 - 70 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="men19_70" id="men19_70" <?php
                    if (is_array($this->men) and (count($this->men) == 4)) {
                        echo 'value="'.$this->men['2']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="men71_300"> &gt; 71 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="men71_300" id="men71_300" <?php
                    if (is_array($this->men) and (count($this->men) == 4)) {
                        echo 'value="'.$this->men['3']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
            </tr>
            <tr>
                <td width="100" align="left" colspan="8"><b><?php echo JText::_('COM_JOOMDIET_WOMEN'); ?></b></td>
            </tr>
                <!-- row browsing -->
                <td width="100" align="right"><label for="women9_13">9 - 13 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="women9_13" id="women9_13" <?php
                    if (is_array($this->women) and (count($this->women) == 4)) {
                        echo 'value="'.$this->women['0']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="women14_18">14 - 18 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="women14_18" id="women14_18" <?php
                    if (is_array($this->women) and (count($this->women) == 4)) {
                        echo 'value="'.$this->women['1']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="women19_70">19 - 70 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="women19_70" id="women19_70" <?php
                    if (is_array($this->women) and (count($this->women) == 4)) {
                        echo 'value="'.$this->women['2']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="women71_300"> &gt; 71 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="women71_300" id="women71_300" <?php
                    if (is_array($this->women) and (count($this->women) == 4)) {
                        echo 'value="'.$this->women['3']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
            <tr>
                <td width="100" align="left" colspan="8"><b><?php echo JText::_('COM_JOOMDIET_LACTATION'); ?></b></td>
            </tr>
                <!-- row browsing -->
            <tr>
                <td width="100" align="right"><label for="lactation0_18">19 - 50 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="lactation0_18" id="lactation0_18" <?php
                    if (is_array($this->lactation) and (count($this->lactation) == 2)) {
                        echo 'value="'.$this->lactation['0']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="lactation19_50">19 - 50 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="lactation19_50" id="lactation19_50" <?php
                    if (is_array($this->lactation) and (count($this->lactation) == 2)) {
                        echo 'value="'.$this->lactation['1']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
            </tr>
            <tr>
                <td width="100" align="left" colspan="8"><b><?php echo JText::_('COM_JOOMDIET_GESTATION'); ?></b></td>
            </tr>
            <tr>
                <td width="100" align="right"><label for="gestation0_18">19 - 50 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="gestation0_18" id="gestation0_18" <?php
                    if (is_array($this->gestation) and (count($this->gestation) == 2)) {
                        echo 'value="'.$this->gestation['0']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
                <td width="100" align="right"><label for="gestation19_50">19 - 50 <?php echo JText::_('COM_JOOMDIET_YEARS'); ?></label></td>
                <td><input class="text_area" type="text" size="32" maxlength="45" name="gestation19_50" id="gestation19_50" <?php
                    if (is_array($this->gestation) and (count($this->gestation) == 2)) {
                        echo 'value="'.$this->gestation['1']->suggested_value.'"';
                    } else echo 'value="0"';
                ?>/></td>
            </tr>
        </table>
    </fieldset>
</div>

<input type="hidden" name="option" value="com_joomdiet" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="variable" />

</form>
